﻿#region License
// (c) Garry McGlennon 2009
// 
// This project is made available under the Microsoft Public License (Ms-PL)
// Code is provided as is and with no warrenty – Use at your own risk
// 
// View the project and the latest code at http://dnpframework.codeplex.com/
// 
// All other rights reserved.
// 
// blog: www.dotNetProfessional.com/blog/
#endregion

using dnp.DomainModeler;
using dnp.ServiceModel.Configuration;
using dnp.Framework.Scripting;

namespace dnp.ServiceModel
{
    public class EntityMetaData
    {
        private readonly EntityMetaDataDefinition _definition;
        private readonly dnpModel _model;


        public EntityMetaData(EntityMetaDataDefinition definition, dnpModel model)
        {
            _definition = definition;
            _model = model;
        }

        public dnpModel Model
        {
            get { return _model; }
        }

        public string Filename(Entity entity)
        {
           return Naming.EvaluateNamingExpression(_definition.Filename, entity); 
        }

        public string GeneratedFilename(Entity entity)
        {
           return Naming.EvaluateNamingExpression(_definition.GeneratedFilename, entity); 
        }
    }

}
